package com.jdbc.dao;

import com.jdbc.entity.Book;
import com.jdbc.entity.Test;
import com.jdbc.test.Student;

import java.util.List;

/**
 * @author wzm
 * @create 2023-11-01 10:16
 * project_name:web2310
 */
public class BaseDaoTest{
    public static void main(String[] args) {
        BaseDao baseDao = new BaseDao();
        //测试新增
//        String sql = "insert into test values(?,?)";

        //测试修改
        //String sql = "update test set name = ? where id = ?";

        //测试删除
    /*    String sql = "delete from test where id = ?";

        int i = baseDao.update(sql, 6);
        if(i > 0){
            System.out.println("操作成功");
        }*/
        //测试查询一个集合
        //String sql = "select * from test where id < ?";
//        String sql = "select * from test where id = ?";
//        String sql = "select * from book";
//        List<Book> books = baseDao.selectForList(Book.class, sql);
//        System.out.println(books);

//        String sql = "select * from book where id = ?";
//        Book book = baseDao.selectbyOne(Book.class, sql, 1);
//        System.out.println("book = " + book);

        String sql = "select avg(id) from book";
        Object o = baseDao.selectForValue(sql);
        System.out.println("o = " + o);
    }


}
